using System;
using System.Collections.Generic;
using System.Text;
using DTO;

namespace DAO
{
   public static class DocgiaDAO
   {
       public static bool themdocgia(DocgiaDTO sdto)
       {
           string sql = "insert into Docgia(MaDG,TenDG,NS,GT,DiaChi) values('" + sdto.MaDG + "','" + sdto.TenDG + "',#" + sdto.NS + "#," + sdto.GT + ",'" + sdto.DiaChi + "')";
           return DataProvider.ExecuteNonQuery(sql);
       }
       public static bool xoadocgia(DocgiaDTO sdto)
       {
           string sql = "delete from Docgia where MaDG='" + sdto.MaDG + "'";
           return DataProvider.ExecuteNonQuery(sql);
       }
       public static bool updatedocgia(DocgiaDTO sdto)
       {
           try
           {
               string sql = "update Docgia set TenDG='" + sdto.TenDG + "',NS='" + sdto.NS + "',GT=" + sdto.GT + ",DiaChi='" + sdto.DiaChi + "'where MaDG='" + sdto.MaDG + "'";
               return DataProvider.ExecuteNonQuery(sql);
           }
           catch (Exception ex)
           {
               throw new Exception(ex.Message);
           }
       }

    }
}
